package euler;

import euler.p051_100.Euler051;

public class Main {

    public static void main(String[] args) {
        try {
        	Euler051 problem = new Euler051();

            long startFull = System.nanoTime();
            String solution = problem.resolve(8);
            long endFull = System.nanoTime();

            System.out.println(solution);

            System.out.println();
            System.out.println("Elapsed " + (toSeconds(endFull-startFull)) + " seconds.");
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private static String toSeconds(long timeinNanos) {
        long timeInmicros = timeinNanos/1000;
        int i = (int)(timeInmicros % 1000000);
        String padding = String.valueOf(i);
        while (padding.length() < 6) {
            padding= '0' + padding;
        }
        return (timeInmicros/1000000) + "." + padding;
    }
}
